let User = require('../../db/userSchema');
const md5 = require('md5');
module.exports = async(req, res) => {

    let editUserMsg = {
        username: req.body.username,
        password: md5(req.body.password),
        age: req.body.age,
        sex: req.body.sex,
        address: req.body.address
    };
    // 设置数据库修改的操作
    let relEdit = await User.updateOne({ "_id": req.params.userId }, editUserMsg);
    console.log(relEdit);

    if (relEdit) {
        res.redirect('/admin/userlist');
    } else {
        res.status(500).end('修改失败');
    }

}